﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace Contracts
{
    [ServiceContract(Namespace = "http://www.kim.org/",
    Name = "kim",
    CallbackContract = typeof(IClient),
    SessionMode = SessionMode.Required)]
    public interface IServer
    {
        [OperationContract(IsInitiating = true, IsTerminating = false, IsOneWay = false)]
        void Login(string mail, string password);
        [OperationContract(IsInitiating = false, IsTerminating = true, IsOneWay = true)]
        void Logout();

        [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = true)]
        void SendMessage(string to, string message);
        [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)]
        List<Message> GetUnreadMessages();

        [OperationContract(IsInitiating = true, IsTerminating = true, IsOneWay = false)]
        bool AddUser(string mail, string password);
        [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)]
        User GetUser();
        [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = true)]
        void UpdateUser(User user);

        [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = true)]
        void UploadAvatar(byte[] avatar);
        [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)]
        byte[] DownloadAvatar(string mail);

        [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)]
        List<string> GetGroupList();

        [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)]
        List<Contact> GetContactList();
        [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)]
        bool AddContact(Contact contact);
        [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)]
        bool EditContact(Contact contact);
        [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)]
        bool DeleteContact(string mail);
    }
}